<template>
  <div class="login">
    <h2>LOGIN...</h2>
    <div class="form">
      <div class="form-item">
        <label for="" class="iconfont icon-xingmingyonghuming"> </label>
        <input type="text" v-model="formData.username" placeholder="" />
      </div>
      <div class="form-item">
        <label
          class="iconfont icon-mima
"
        >
        </label>
        <input type="password" v-model="formData.password" placeholder="" />
      </div>
      <div class="form-btn">
        <button @click="toRegister">去注册</button>
        <button @click="submitLogin">登录</button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      formData: {
        username: 'liucc',
        password: '123',
      },
    }
  },
  methods: {
    submitLogin() {
      const formData = this.formData
      this.$emit('user-login', { formData })
    },
    toRegister() {
      this.$parent.changeView(3)
    },
  },
}
</script>

<style scoped>
.login {
  width: 100vw;
  height: 100vh;
  background-color: #ffffff;
  color: #666666;
  display: flex;
  padding: 1rem;
  /* justify-content: center; */
  align-items: center;
  flex-direction: column;
  padding-top: 20vh;
}
.login h2 {
  text-align: center;
  color: #007acc;
  font-size: 3rem;
  text-shadow: 5px 5px 5px #cccccc;
}
.form {
  width: 100%;
}
.form-item {
  width: 100%;
  margin-bottom: 1rem;
  position: relative;
}
.form-item label {
  position: absolute;
  left: 5%;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  font-weight: 600;
}
.form-item input {
  width: 100%;
  line-height: 3rem;
  border: none;
  outline: none;
  flex: 3;
  border: 1px solid #666666;
  border-radius: 10px;
  text-align: center;
  font-size: 1rem;
}

.form-btn {
  display: flex;
  margin-top: 2rem;
}

.form-btn button {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  border: 1px solid #007acc;
  border-radius: 8px;
  background-color: #007acc;
  color: #ffffff;
  line-height: 3rem;
  font-size: 1rem;
}
.form button:nth-child(1) {
  background-color: #eeeeee;
  border: 1px solid #eeeeee;
  color: #000000;
  margin-right: 1.25rem;
}
</style>
